;----- Paragraph @irq@ -----

graj .byte $00

irq

	inc $d019

	lda #13
	sta $d02c

	lda #<irqplaymsx
	ldy #>irqplaymsx
	sta $0314
	sty $0315

	lda #130
	sta $D012
	lda $d011
	and #127
	sta $d011

;                inc $d020
;		lda $d019
;		tax

;		txa
;		and #128
;		cmp #128
;		bne endirq

;

                jsr checkjoy

endirq		;dec $d020

		ldy sinusp
		dey
		bpl aaab
		ldy #$3f
		sty sinusp
aaab
		lda SINUS,y
		sta $d00e
		dec sinusp

		jmp $ea81
;;;;;;;;;;;;;;;;;;;

irqplaymsx
		inc $d019

		lda #<irq1_5
		ldy #>irq1_5
		sta $0314
		sty $0315

		lda #$e8
		sta $D012
		lda $d011
		and #127
		sta $d011

	 	lda #$00
		cmp graj
		beq niegraj
;		inc $d020
		jsr $1003
		jsr clk_tick

;		
		;dec $d020
niegraj
		jsr put_lcd
	
		
	
		jmp $ea31

;; irq1_5 ;-)

irq1_5
	inc $d019

;	inc $d020

	    lda #0	; Y expand
	sta $d017

	
	lda #<irq2
	ldy #>irq2
	sta $0314
	sty $0315

	lda #$f8
	sta $D012
	lda $d011
	and #127
	sta $d011


;	dec $d020

	jmp $ea81


;;;;;;;
;;;;;; IRQ2

irq2
     ;   inc $d020
        inc $d019

        lda $d011
        and #(255-8)
        sta $d011

	jsr clock_rysuj

	lda #<sscrollirq
	ldy #>sscrollirq
	sta $0314
	sty $0315

	lda #$01
	sta $D012
	lda $d011
	and #127
	sta $d011

	;dec $d020

        ldx #30
k2        nop
        nop
        dex
        bne k2

        lda $d011
        ora #8
        sta $d011

	

        jmp $ea81
